package cn.leestudio.springboot.controller;

import cn.leestudio.springboot.model.base.ResponseBean;
import cn.leestudio.springboot.redis.RedisService;
import cn.leestudio.springboot.service.CommonService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2017/10/10.
 */
@RestController
@RequestMapping("/Index")
public class HelloController {

    @Autowired
    private CommonService commonService;
//    @Autowired
//    private RedisService redisService;

    @ApiOperation(value="创建用户", notes="根据User对象创建用户",response = ResponseBean.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long",paramType="query"),
            @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "ResponseBean")
    })
    @ApiResponses({ @ApiResponse(code = 400, message = "Invalid Order") })
    @GetMapping(value = "/index")
    public String index(){
//        System.out.println("cache => "+redisService.get("lihui"));
        try{
            commonService.getPageTest();
        }catch (Exception e){
            e.printStackTrace();
        }
        return new ResponseBean(200,"fuck !!","haha").toString();
    }

}
